package com.miplus.ccrm.core.service.aiqm;

import com.miplus.ccrm.common.JPubUtils;
import lombok.Data;

@Data
public class DlgContent {
    //客户内容
    private String c_headStr="";
    private String c_endStr="";
    private String c_allStr="";

    //催员内容
    private String a_headStr="";
    private String a_endStr="";
    private String a_allStr="";

    //全部内容
    private String headStr="";
    private String endStr="";
    private String allStr="";

    public void addStr(String s,String role) {
        if(JPubUtils.IsEqual(role,"cust")){
            c_allStr+=s;
            if(c_headStr.length()<2){
                c_headStr+=s;
            }
        }
        else{
            a_allStr+=s;
            if(a_headStr.length()<2){
                a_headStr+=s;
            }
        }
    }

    public void addEnd(String s,String role)
    {
        if(JPubUtils.IsEqual(role,"cust")){
            if(c_endStr.length()<2){
                c_endStr+=s;
            }
        }
        else{
            if(a_endStr.length()<2){
                a_endStr+=s;
            }
        }
    }

    public void buildAll()
    {
        headStr=c_headStr+a_headStr;
        endStr=c_endStr+a_endStr;
        allStr=c_allStr+a_allStr;
    }

    public String getContent(String role,String range)
    {
        String contentStr="";
        if(JPubUtils.IsEqual(role,"1")){//催员
            if(JPubUtils.IsEqual(range,"11")){//开头语
                contentStr=a_headStr;
            }
            else if(JPubUtils.IsEqual(range,"12")){//结束语
                contentStr=a_endStr;
            }
            else{
                contentStr=a_allStr;
            }
        }
        else if(JPubUtils.IsEqual(role,"2")){//客户
            if(JPubUtils.IsEqual(range,"11")){//开头语
                contentStr=c_headStr;
            }
            else if(JPubUtils.IsEqual(range,"12")){//结束语
                contentStr=c_endStr;
            }
            else{
                contentStr=c_allStr;
            }
        }
        else{//全部角色
            if(JPubUtils.IsEqual(range,"11")){//开头语
                contentStr=headStr;
            }
            else if(JPubUtils.IsEqual(range,"12")){//结束语
                contentStr=endStr;
            }
            else{
                contentStr=allStr;
            }
        }
        return contentStr;
    }
}
